package com.example.testanimation.testdownload;

import android.os.Bundle;
import com.lenovo.nova.util.BaseActivity;
import com.lenovo.nova.util.debug.mylog;
import com.lenovo.nova.util.network.NetworkTask;

import java.io.File;

/**
 * Created by scenic on 2/3/15.
 */
public class DownloadActivity extends BaseActivity{
    private static final String TAG = DownloadActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

    }


    @Override
    protected void onResume() {
        super.onResume();
        NetworkTask task = new NetworkTask(this);
        task.registerDownloadBroadcast();
        String url = "http://apache.fayea.com/tomcat/tomcat-8/v8.0.18/bin/apache-tomcat-8.0.18-windows-i64.zip";
        long id = task.executeDownload(url, null, new NetworkTask.DownloadNotify() {
            @Override
            public void onProgress(int progress) {
                mylog.i(TAG, "progress " + progress);
            }

            @Override
            public void onFinishDownload(File srcFile, File destFile) {

            }

            @Override
            public void onError(int code) {

            }
        }, null);
    }
}
